﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

using Visifire.Charts;
using Marking.Dashboard.Infrastructures;
using Marking.Dashboard.ViewModels.Finance;

namespace Marking.Dashboard.Views.Finance
{
    public partial class FinancePieChartView : UserControl
    {
        public FinancePieChartView()
        {
            InitializeComponent();
        }

        private void DataSeries_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            var data = (sender as DataPoint);

            var financeInfo = (this.DataContext as FinancePieChartViewModel)
                .FirstOrDefault(x => x.ItemName == data.AxisXLabel);

            if (financeInfo == null)
            {
                return;
            }

            ReportHelper.Show("/application/marketingfinance/Pro_FA_GetGatherTypeMoneyByPaymentType.htm", new
            {
                StartDate = financeInfo.StartDate.ToString("yyyy-MM-dd"),
                EndDate = financeInfo.EndDate.ToString("yyyy-MM-dd")
            });
        }
    }
}
